from django.db import models
from django.db.models import ForeignKey, CASCADE


# Create your models here.
class User(models.Model):
    UserName = models.CharField(max_length=20,verbose_name='用户名')  #用户名
    UserAccount = models.CharField(max_length=8,verbose_name='用户账号') #用户账号
    UserPassword = models.CharField(max_length=8,verbose_name='用户密码') #用户密码
    Last_login = models.TimeField(auto_now=True) #用户上次登录时间
    user_img = models.ImageField(upload_to='user_images/', max_length=100, blank=True, null=True, verbose_name=u'用户头像')
    def __str__(self):
        return self.UserName

class Car(models.Model):
    Cartype = models.CharField(max_length=50,verbose_name="汽车厂商",null=True)
    Carname = models.CharField(max_length=70,verbose_name="车名",null=True)
    CarPrice = models.CharField(max_length=20,verbose_name="汽车价格",null=True)
    Cards = models.CharField(max_length=255,verbose_name="上牌数量",null=True)
    CarPoint = models.DecimalField(max_digits=3,decimal_places=1,verbose_name="评分",null=True)
    handle = models.ManyToManyField(User)
    def __str__(self):
        return self.Carname






